/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Servidor.Controlador;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;

/**
 * This class clean the socket, the BufferedReader and the PrintWritter
 * @author Jorge Perez
 */
public class TrashTask extends Thread implements OcaTask {

    Socket socket;
    BufferedReader read;
    PrintWriter write;

    public TrashTask(Socket incoming, BufferedReader read, PrintWriter write) {
        this.read = read;
        this.write = write;
        this.socket = socket;
    }

    @Override
    public void executeTask() {
        this.start();
    }

    @Override
    public void run() {
        try {
            read.close();
            write.close();
            socket.close();
        } catch (IOException ex) {
            System.out.println("Las conexiones no pudieron cerrarse");
        }
    }
}
